<?php
return array(
    'method' => 'POST',
	'action' => '',
    'elements' => array(
		'user_login' => array(
			'type' => 'text',
			'options' => array(
				'order' => 5,
				'label' => 'Логин',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'List',
						'breakChainOnFailure' => false,
						'options' => array(
							'mode' => 'or',
							'validators' => array(
								array(
									'validator' => 'Identical',
									'breakChainOnFailure' => true,
								),
								array(
									'validator' => 'List',
									'breakChainOnFailure' => true,
									'options' => array(
										'validators' => array(
											array(
												'validator' => 'StringLength',
												'breakChainOnFailure' => true,
												'options' => array('max' => 255),
											),
											array(
												'validator' => 'Alnum',
												'breakChainOnFailure' => true,
												'options' => array('allowWhiteSpace' => true),
											),
											array(
												'validator' => 'NotInArray',
												'breakChainOnFailure' => true,
												'options' => array(
													'haystack' => array(
														Users_Model_User::SYSTEM_LOGIN,
														Users_Model_User::GUEST_LOGIN,
													),
												),
											),
											array(
												'validator' => 'Db_NoRecordExists',
												'breakChainOnFailure' => true,
												'options' => array(
												'table' => 't_user',
													'field' => 'login',
												),
											),
										),
									),
								),					
							),
						),
					),
				),
			)
		),
		'user_new_password' => array(
			'type' => 'password',
			'options' => array(
				'order' => 7,
				'label' => 'Новый пароль',
				'required' => false,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('min' => 6)
					),
				),
			),
		),
		'user_new_password_confirm' => array(
			'type' => 'password',
			'options' => array(
				'order' => 8,
				'label' => 'Подтверждение пароля',
				'required' => false,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'Identical',
						'breakChainOnFailure' => true,
						'options' => array('token' => ''),
					),
				),
			),
		),
		'user_last_name' => array(
			'type' => 'text',
			'options' => array(
				'order' => 11,
				'label' => 'Фамилия',
				'required' => false,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 64),
					),
				),
			),
		),
		'user_first_name' => array(
			'type' => 'text',
			'options' => array(
				'order' => 12,
				'label' => 'Имя',
				'required' => false,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 64),
					),
				),
			),
		),
		'user_patronymic' => array(
			'type' => 'text',
			'options' => array(
				'order' => 13,
				'label' => 'Отчество',
				'required' => false,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 64),
					),
				),
			),
		),
		'user_email' => array(
			'type' => 'text',
			'options' => array(
				'order' => 15,
				'label' => 'E-mail',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'List',
						'breakChainOnFailure' => false,
						'options' => array(
							'mode' => 'or',
							'validators' => array(
								array(
									'validator' => 'Identical',
									'breakChainOnFailure' => true,
								),
								array(
									'validator' => 'List',
									'breakChainOnFailure' => true,
									'options' => array(
										'validators' => array(
											array(
												'validator' => 'EmailAddress',
												'breakChainOnFailure' => true,
											),
											array(
												'validator' => 'StringLength',
												'breakChainOnFailure' => true,
												'options' => array('max' => 64)
											),
											array(
												'validator' => 'Db_NoRecordExists',
												'breakChainOnFailure' => true,
												'options' => array(
													'table' => 't_user',
													'field' => 'email',
												),
											),
										),
									),
								),					
							),
						),
					),
				),
			)
		),
		/*'avatar' => array(
			'type' => 'file',
			'options' => array(
				'order' => 16,
				'label' => 'Аватар',
				'required' => false,
				'validators' => array(
                    array(
                        'validator' => 'Size',
                        'breakChainOnFailure' => true,
                        'options' => '10Mb'
				    ),
				),
			),
		),*/
		'message_by_email' => array(
			'type' => 'checkbox',
			'options' => array(
				'order' => 18,
				'label' => 'Получать сообщения по электронной почте',
				'required' => false,
				'filters' => array(
					'int'
				),
                'checkedValue' => 1,
                'uncheckedValue' => 0,
                'checked' => false,
			),
		),
		'user_password' => array(
			'type' => 'password',
			'options' => array(
				'order' => 20,
				'label' => 'Текущий пароль',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'Identical',
						'breakChainOnFailure' => true,
					),
				),
			)
		),
		'submit_button' => array(
            'type' => 'submit',
            'options' => array(
                'order' => 50,
                'title' => 'Сохранить изменения',
            )
        )
    )
);
?>